package com.nipun.neural.objects.neurons;

public class LinearNeuron extends BaseNeuronImpl {
	
	public LinearNeuron(String label){
		super(label);
	}
	
	public void fire(double input) {
		setActivation(actFunction(input)+getBias());
	}
	
	public double getDerivative(){
		double act = getActivation();
		if(act<0){
			return 0;
		}else if (act <1){
			return 1;
		}
		return 0;
	}
	
	public double actFunction(double input){
		if(input<0)
		{
			return 0;
		}else if(input < 1){
			return input;
		}else{
			return 1;
		}
	}

}
